package com.itheima.stream;

import java.util.ArrayList;
import java.util.List;

/*
体验一下stream流的快乐
 */
public class Demo01 {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>(List.of("张三丰", "张无忌", "张翠山", "王二麻子", "张良", "谢广坤"));

        ArrayList<String> zhangList = new ArrayList<>();
        // 筛选姓张的
        for (String s : list) {
            if(s.startsWith("张")){
                zhangList.add(s);
            }
        }
        ArrayList<String> length3List = new ArrayList<>();

        //长度是三个字的

        for (String s : zhangList) {
            if(s.length()==3){
                length3List.add(s);
            }

        }
        System.out.println(length3List);

    }

}
